<?php
if (!defined("ADMREAD")) exit();

class browser
{
    var $curl_resource = null;
	var $curl_failonerror = false;
	var $curl_followlocation = true;
	var $curl_returntransfer = true;
	var $curl_timeout = 15;
	var $curl_post = true;
	var $curl_useragent = array(
	                             'Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3',
	                             'Opera/9.80 (Windows NT 5.1; U; en) Presto/2.5.22 Version/10.51',
	                             'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'
	                             );

    function browser()
    {
        $this->curl_resource = curl_init();
    }

    function content($url)
    {
        $r = rand(0,count($this->curl_useragent)-1);
        curl_setopt($this->curl_resource, CURLOPT_URL , $url);
		curl_setopt($this->curl_resource, CURLOPT_FAILONERROR , $this->curl_failonerror);
		curl_setopt($this->curl_resource, CURLOPT_RETURNTRANSFER , $this->curl_returntransfer);
		curl_setopt($this->curl_resource, CURLOPT_TIMEOUT , $this->curl_timeout);
		curl_setopt($this->curl_resource, CURLOPT_USERAGENT, $this->curl_useragent[$r]);
        return array(
                     'page' => curl_exec($this->curl_resource),
                     'error' => curl_errno($this->curl_resource),
                     'errmsg' => curl_error($this->curl_resource)
                     );
	}

    function close()
    {
        curl_close($this->curl_resource);
    }

}
?>